//
//  LeagueScoreRankViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/15.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//


//联赛积分排名
#import "LeagueScoreRankViewCell.h"

#import "LeagueScoreRankModel.h"

@interface LeagueScoreRankViewCell ()


/**
 *全场
 */
@property(nonatomic,strong)UILabel*overallLabel;




/**
 *赛
 */
@property(nonatomic,strong)UILabel*gameLabel;


/**
 *胜
 */
@property(nonatomic,strong)UILabel *winLabel;


/**
 *平
 */
@property(nonatomic,strong)UILabel*drawLabel;




/**
 *负
 */
@property(nonatomic,strong)UILabel*lossLabel;





/**
 *得
 */
@property(nonatomic,strong)UILabel*getLabel;


/**
 *失
 */
@property(nonatomic,strong)UILabel *missLabel;


/**
 *积分
 */
@property(nonatomic,strong)UILabel*scoreLabel;




/**
 *排名
 */
@property(nonatomic,strong)UILabel*rankLabel;



/**
 *胜率
 */
@property(nonatomic,strong)UILabel*winPropLabel;


@end



@implementation LeagueScoreRankViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        
        //开始高度
        float partY = 0;
        
        CGFloat leftWidth = kScreenIp6(45);
        CGFloat rightWidth = kScreenIp6(45);
        CGFloat partWidth = (kScreenWidth - leftWidth - rightWidth) / 8;
        CGFloat partHeight = 35;
        
        //全场
        self.overallLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, partY, leftWidth + kScreenIp6(5), partHeight)];
        self.overallLabel.font = [UIFont systemFontOfSize:12];
        self.overallLabel.textAlignment = NSTextAlignmentCenter;
        self.overallLabel.text = @"全场";
        
        [self addSubview:_overallLabel];
        
        
        
        //赛
        self.gameLabel = [[UILabel alloc]initWithFrame:CGRectMake(leftWidth, partY, partWidth, partHeight)];
        self.gameLabel.font = [UIFont systemFontOfSize:12];
        self.gameLabel.textAlignment = NSTextAlignmentCenter;
        
        self.gameLabel.text = @"赛";
        
        [self addSubview:_gameLabel];
        

        
        //胜
        self.winLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.gameLabel.frame), partY, partWidth, partHeight)];
        self.winLabel.font = [UIFont systemFontOfSize:12];
        self.winLabel.textAlignment = NSTextAlignmentCenter;
        
        self.winLabel.text = @"胜";
        
        [self addSubview:_winLabel];
        
        
        //平
        self.drawLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.winLabel.frame), partY, partWidth, partHeight)];
        self.drawLabel.font = [UIFont systemFontOfSize:12];
        self.drawLabel.textAlignment = NSTextAlignmentCenter;
        
        self.drawLabel.text = @"平";
        [self addSubview:_drawLabel];
        
        
        
        
        //负
        self.lossLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.drawLabel.frame), partY, partWidth, partHeight)];
        self.lossLabel.font = [UIFont systemFontOfSize:12];
        self.lossLabel.textAlignment = NSTextAlignmentCenter;
        self.lossLabel.text = @"负";
        [self addSubview:_lossLabel];
        
        
        
        //得
        self.getLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.lossLabel.frame), partY, partWidth, partHeight)];
        self.getLabel.font = [UIFont systemFontOfSize:12];
        self.getLabel.textAlignment = NSTextAlignmentCenter;
        self.getLabel.text = @"得";
        [self addSubview:_getLabel];
        
        
        
        
        //失
        self.missLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.getLabel.frame), partY, partWidth, partHeight)];
        self.missLabel.font = [UIFont systemFontOfSize:12];
        self.missLabel.textAlignment = NSTextAlignmentCenter;
        self.missLabel.text = @"失";
        [self addSubview:_missLabel];
        
        //积分
        self.scoreLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.missLabel.frame), partY, partWidth, partHeight)];
        self.scoreLabel.font = [UIFont systemFontOfSize:12];
        self.scoreLabel.textAlignment = NSTextAlignmentCenter;
        self.scoreLabel.text = @"积分";
        [self addSubview:_scoreLabel];
        
        
        
        //排名
        self.rankLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.scoreLabel.frame), partY, partWidth, partHeight)];
        self.rankLabel.font = [UIFont systemFontOfSize:12];
        self.rankLabel.textAlignment = NSTextAlignmentCenter;
        self.rankLabel.text = @"排名";
        [self addSubview:_rankLabel];
        
        
        
        //胜率
        self.winPropLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.rankLabel.frame), partY, partWidth, partHeight)];
        self.winPropLabel.font = [UIFont systemFontOfSize:12];
        self.winPropLabel.textAlignment = NSTextAlignmentCenter;
        self.winPropLabel.adjustsFontSizeToFitWidth = YES;
        self.winPropLabel.text = @"胜率";
        [self addSubview:_winPropLabel];
        
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self.contentView addSubview:footLineView];
        
        
        // 设置 cell 点击没有变化
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    
    return self;
    
}

-(void)setCellValue:(LeagueScoreRankModel*)model
{
    
    /**
     *全场
     */
    self.overallLabel.text = model.overall;
    
    
    
    
    /**
     *赛
     */
    self.gameLabel.text = model.game;
    
    
    /**
     *胜
     */
    self.winLabel.text = model.win;
    
    
    /**
     *平
     */
    self.drawLabel.text = model.draw;
    
    
    
    
    /**
     *负
     */
    self.lossLabel.text = model.loss;
    
    
    
    
    
    /**
     *得
     */
    self.getLabel.text = model.get;
    
    
    /**
     *失
     */
    self.missLabel.text = model.miss;
    
    
    /**
     *积分
     */
    self.scoreLabel.text = model.score;
    
    
    
    
    /**
     *排名
     */
    self.rankLabel.text = model.rank;
    
    
    
    /**
     *胜率
     */
    self.winPropLabel.text = model.winProp;
    
    
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
